package com.tudouji.project.bill.service.impl;

import java.math.BigDecimal;
import java.util.List;

import com.tudouji.common.utils.DateUtils;
import com.tudouji.common.utils.SecurityUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.tudouji.project.bill.mapper.WhinformitemMapper;
import com.tudouji.project.bill.domain.Whinformitem;
import com.tudouji.project.bill.service.IWhinformitemService;

/**
 * 入库单明细Service业务层处理
 * 
 * @author wf
 * @date 2021-01-07
 */
@Service
public class WhinformitemServiceImpl implements IWhinformitemService 
{
    @Autowired
    private WhinformitemMapper whinformitemMapper;

    /**
     * 查询入库单明细
     * 
     * @param guid 入库单明细ID
     * @return 入库单明细
     */
    @Override
    public Whinformitem selectWhinformitemById(String guid)
    {
        return whinformitemMapper.selectWhinformitemById(guid);
    }

    /**
     * 查询入库单明细列表
     * 
     * @param whinformitem 入库单明细
     * @return 入库单明细
     */
    @Override
    public List<Whinformitem> selectWhinformitemList(Whinformitem whinformitem)
    {
        return whinformitemMapper.selectWhinformitemList(whinformitem);
    }

    /**
     * 新增入库单明细
     * 
     * @param whinformitem 入库单明细
     * @return 结果
     */
    @Override
    public int insertWhinformitem(Whinformitem whinformitem)
    {
        whinformitem.setCreateTime(DateUtils.getNowDate());
        whinformitem.setCreateBy(SecurityUtils.getLoginUser().getUser().getUserId());
        return whinformitemMapper.insertWhinformitem(whinformitem);
    }

    /**
     * 修改入库单明细
     * 
     * @param whinformitem 入库单明细
     * @return 结果
     */
    @Override
    public int updateWhinformitem(Whinformitem whinformitem)
    {
        return whinformitemMapper.updateWhinformitem(whinformitem);
    }

    /**
     * 批量删除入库单明细
     * 
     * @param guids 需要删除的入库单明细ID
     * @return 结果
     */
    @Override
    public int deleteWhinformitemByIds(String[] guids)
    {
        return whinformitemMapper.deleteWhinformitemByIds(guids);
    }

    /**
     * 删除入库单明细信息
     * 
     * @param guid 入库单明细ID
     * @return 结果
     */
    @Override
    public int deleteWhinformitemById(String guid)
    {
        return whinformitemMapper.deleteWhinformitemById(guid);
    }

    @Override
    public BigDecimal sumCountByOrderIdAndSpeId(Whinformitem whinformitem) {
        return whinformitemMapper.sumCountByOrderIdAndSpeId(whinformitem);
    }
}
